package cn.bj.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.bj.beans.Rotate;
import cn.bj.dao.RotateMapper;

@Service
public class RotateService {

	@Autowired
	RotateMapper rotateMapper;

	// 获取所有轮播图
	public List<Rotate> getAllRotats() {
		return rotateMapper.selectByExample(null);
	}

	// 插入新增图片
	public int insertRotate(Rotate rotate) {
		return rotateMapper.insert(rotate);
	}

	// 删除
	public int deleteRotate(int id) {
		return rotateMapper.deleteByPrimaryKey(id);
	}

	// 根据id查询单个
	public Rotate selectById(Integer id) {
		return rotateMapper.selectByPrimaryKey(id);
	}

	public int updateRotate(Rotate rotate) {
		return rotateMapper.updateByPrimaryKey(rotate);
	}

}
